#coding=utf-8
import unittest,xlrd
from Public import Calc

class TestCals(unittest.TestCase):
    def setUp(self):
        print 'begin'
    def test_add(self):
        wb = xlrd.open_workbook("F:\PyWorkSpace\TestAdd\Data\dataSource.xls")
        sh = wb.sheet_by_name("doAdd")
        rows = sh.nrows
        for i in range(1, rows):
            num1 = sh.cell_value(i, 0)
            num2 = sh.cell_value(i, 1)
            excepResult = sh.cell_value(i, 2)
            c=Calc.add(num1,num2)
            re=self.assertEqual(excepResult,c,msg='error1')
            print num1,num2,excepResult,c,re
    def tearDown(self):
        print 'end'
if __name__=="__main__":
    unittest.main()
